package abcy.cloud.syscoreserver.utils;
//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//


import java.text.NumberFormat;

import com.alibaba.cloud.commons.lang.StringUtils;
import org.springframework.stereotype.Component;

@Component
public class CodeUtil {
    public CodeUtil() {
    }

    public static String codeGenerator(String sign, String code) {
        return StringUtils.isEmpty(code) ? sign + "_0000000001" : generateCode(sign, code);
    }

    private static String generateCode(String sign, String code) {
        Integer num = Integer.parseInt(code.substring(code.substring(0, code.indexOf("_")).length() + 1, code.length()));
        NumberFormat formatter = NumberFormat.getNumberInstance();
        formatter.setMinimumIntegerDigits(10);
        formatter.setGroupingUsed(false);
        code = sign + "_" + formatter.format((long)(num + 1));
        return code;
    }
}
